/*
 * Copyright 2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.dopdf.document.model;

/**
 * This is an Evaluator class used with a specific type.  This interface will be used by @see CollectionUtil class.
 * whenever we want to iterate over a collection and invoke a specific method on all of the collection elements,
 * we use an instance of this Interface and implement the evaluate method to return true of false base on the
 * implementation. Since Java does not have closures yet! we use this technique to achive functionality like
 * findAll, returnTrueIfAllTrue on a collection.
 * For valid examples have a look at @see AgreementItemCollection class.
 *
 * @param <T> the generic type.  Could be any class such as AgreementItem, Reservation etc.
 * @author deep
 */
public interface ConditionEvaluator<T> {

	/**
	 * Implement this method to return true of false based on a specific condition.
     * The type object is passed as argument, so that we maintain type safety.
	 *
	 * @param entity the entity instance.
	 * @return true, if the condition we are interested in is true.
	 */
	boolean evaluate(T entity);
}
